home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12901 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.7 KB

  1. Path: news.internex.net.au!usenet
  2. From: sultan@connexus.apana.org.au (Jon Hornstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Floating Point Error Traping by try and catch:-
  5. Date: Fri, 22 Mar 1996 11:28:13 GMT
  6. Organization: Yarra House Software Pty Ltd
  7. Message-ID: <4iu0lv$1cd@preeda.internex.net.au>
  8. References: <4i836n$2u8@dfw-ixnews5.ix.netcom.com> <4iie9e$1pp@news5.erols.com>
  9. NNTP-Posting-Host: dialin-4.internex.net.au
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Chris Cobb <ccobb@cseg.com> wrote:
  13.  
  14. >rajash@ix.netcom.com(Rajash Gopalakrishnan ) wrote:
  15. >>Hi Experts!.
  16. >>
  17. >>We were using normal try and catch statements to trap
  18. >>the exceptional errors occured during C++ class operation.
  19. >>We are working on Soaris C++ 4.1 with Toolsh++ classes.
  20. >>
  21. >[stuff deleted]
  22. >>Here what I found is that before catch, arithemetic experssion fault 
  23. >>occurs and core is dumping. One method I found is to redirect the
  24. >>signal
  25. >>handler and do a catch but that's a round about method. Can anybody 
  26. >>explain how we can handle this situation by try and catch alone. Is
  27. >>there
  28. >>any method to show where error occured and line#.
  29.  
  30. >Well, it seems to me that a floating point error is a hardware trap
  31. >which you may be able to intercept with a signal function (I haven't
  32. >tried to catch one lately).  Within your signal function you could
  33. >then perform a throw.
  34.  
  35. My impression of a signal function is to treat it as a non-local goto
  36. much in the same vein as longjmp. Longjmp's do not cause the programs
  37. to unwind their stacks. With this in mind throwing an exception in a
  38. signal handler would cause the execution thread to be transferred to
  39. the unexpected throw handler. The try/catch block are effectively
  40. nullified by the non-local goto. I have't tried this please correct me
  41. if I am wrong!
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.